home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- Header file: INDECL.H
-
- Contains prototypes and descriptions for externally visible
- (public) routines in INCON.LIB See the file INCON.DOC for
- more information on setting parameters, editing input fields,
- and so on. The routines declared here may be called directly
- from programs that link INCON.LIB
-
- Compiler: Borland Turbo C 2.01
-
- INCON source files and the object and library files created from
- them are:
- Copyright (c) 1993-94, Richard Zigler.
- You may freely distribute unmodified source, object, and library
- files, and incorporate them into your own non-commercial software,
- provided that this paragraph and the program name and copyright
- strings defined in INCON.C are included in all copies.
- *************************************************************************/
-
- /*************************************************************************
- INCON -- Format user input under program control.
-
- Parameters
- ----------
- MBLOCK far * Far pointer to message block.
-
- The message block may be addressed as either a structure or an
- array of unsigned integers. See the header file INDEFS.H for
- the data declarations. See the file INCON.DOC for an extended
- discussion of all parameters. The message block is laid out as
- follows:
-
- +-------------------------------------------------------------------+
- | Offset Low Byte | High Byte |
- | +-----------------------+ |
- | 0 | BufOff | |
- | |-----------------------| |
- | 1 | BufSeg | |
- | |-----------------------| |
- | 2 | KeyOff | |
- | |-----------------------| |
- | 3 | KeySeg | |
- | |-----------------------| |
- | 4 | Flags | |
- | |-----------+-----------| |
- | 5 | Width | Prec | |
- | |-----------+-----------| |
- | 6 | Visible | Attr | |
- | |-----------+-----------| |
- | 7 | Fill | Pad | |
- | +-----------+-----------+ |
- +-------------------------------------------------------------------+
-
- WORD BufOff Offset address of input/output buffer.
-
- WORD BufSeg Segment address of input/output buffer.
-
- WORD KeyOff Offset address of extended-key list.
-
- WORD KeySeg Segment address of extended─key list.
-
- WORD Flags Flags that modify INCON's behavior. They are
- declared separately as the union of an unsigned
- integer and a bit-field, and are laid out as follows:
-
- +-------------------------------------------------------------------+
- | Bit: 15 14 13 12 11 10 9 8 |
- | | \ | / \ / | | |
- | Debug Type Justify Strip Message |
- | ------- ------------- ---------- ------- --------- |
- | 0 = No 0 = Alpha 0 = None 0 = No 0 = No |
- | 1 = Yes 1 = Uppercase 1 = Left 1 = Yes 1 = Yes |
- | 2 = Integer 2 = Center |
- | 3 = Float 3 = Right |
- | 4 = Mixed |
- | |
- | Bit: 7 6 5 4 3 2 1 0 |
- | | | | | | | | | |
- | Sign Display Confirm Delimit xKeys Scroll Hide Template |
- | ---- ------- ------- ------- ----- -------- ---- -------- |
- | For all: 0 = No / 1 = Yes |
- +-------------------------------------------------------------------+
-
- BYTE Width The maximum number of characters allowed
- in the input field.
-
- BYTE Prec For alpha and integer fields: the minimum number
- of characters the user must enter into the input
- field.
- For floating─point fields: the number of digits to
- the right of the decimal point.
-
- BYTE Visible Used in conjunction with the Scroll flag; specifies
- the length of the displayed portion of the input
- field.
-
- BYTE Attr Input field colors, specified as a standard DOS
- attribute byte.
-
- BYTE Fill The character to display in unoccupied areas of the
- input field, as a visual guide to the user. Defaults
- to the space if the quantity specified is less than
- ASCII 32.
-
- BYTE Pad For alpha and integer fields: the character used
- to fill leading or trailing spaces in a justified
- output string. Defaults to the space if the
- quantity specified is less than ASCII 32.
-
- Return
- ------
- INCON returns a short integer that indicates the status of the
- input operation. Only error returns have the high bit set.
-
- 0: Input accepted; no error.
- -1: User input error.
- 27: The user pressed [Esc] to cancel the input operation.
- 74: The user pressed [Keypad -] or [Keypad +] to end input
- 78: (see INCON.DOC for complete information).
- ##: Extended─key code.
-
- Run-Time Errors
- ---------------
- Run─time errors are those made by the programmer, as opposed to
- input errors made by the user, which are handled by the calling
- routine. A run-time error may also occur if INCON can't find
- enough memory for its internal buffers. In response to run-time
- errors, INCON beeps and prints a message in an onscreen "message
- bar" that takes its colors from the Attr parameter. It then waits
- for a keypress before returning an error code to the calling
- routine. The error code returned is the error number from the
- list below, minus 32768 (the high bit is set). Run─time error
- messages have the form
-
- INCON error #: message. Press any key...
-
- where # and message are one of those listed below.
-
- Error # Message
- ------- -----------------------------------------------------
- 1 Invalid field precision
- 2 Invalid field width or scroll visible length
- 3 Default input string too long
- 4 Type float; precision is invalid
- 5 Type float; no room for decimal point
- 6 Fill character appears in template
- 7 Invalid template
- 8 Insufficient memory for internal buffers
- 9 Input/output buffer pointer is NULL
-
- Run-time error messages may be turned off by clearing the Message
- flag. See INCON.DOC for more information.
-
- INCON cannot check the length of the input/output buffer against
- Width. It is the responsibility of the calling routine to insure
- that the buffer is large enough to hold the requested number of
- characters, plus the null terminator.
- *************************************************************************/
-
- short pascal InCon( MBLOCK far * ); /* INCON.C */
-
- /*************************************************************************
- Cursor handling. Call with OFF argument prior to ON, and with
- SAVE prior to RESTORE.
-
- Parameters
- ----------
- short Switch Service required.
-
- Return
- ------
- None
- *************************************************************************/
-
- void pascal Cursor( short CurSwitch ); /* INUTIL.C */
-
- /*************************************************************************
- GetCursor() -- Get absolute screen coordinates.
-
- Parameters
- ----------
- short *Row Screen row (0-24).
- short *Col Screen column (0-79).
-
- Return
- ------
- None
- *************************************************************************/
-
- void pascal GetCursor( short * Row, short * Col ); /* INUTIL.C */
-
- /*************************************************************************
- GetVideoAttr -- Get video attribute at cursor.
-
- Parameters
- ----------
- none
-
- Return
- ------
- int Attribute Current video attribute.
- *************************************************************************/
-
- int pascal GetVideoAttr( void ); /* INUTIL.C */
-
- /*************************************************************************
- PutCursor -- Place cursor at Row and Col.
-
- Parameters
- ----------
- short Row Screen row (0-24).
- short Col Screen column (0-79).
-
- Return
- ------
- None
- *************************************************************************/
-
- void pascal PutCursor( short, short ); /* INUTIL.C */
-
- /*************************************************************************
- WordLeft -- Scan string left from current position to previous
- occurrence of search character.
-
- Parameters
- ----------
- int CurPos Current position within String.
- char far *String String to scan.
- char SearchChar Quit scan at this character.
-
- Return
- ------
- int CurPos Pointer to character following SearchChar.
- *************************************************************************/
-
- int pascal WordLeft( int, char far *, char ); /* INUTIL.C */
-
- /*************************************************************************
- WordRight -- This operation is the mirror image of WordLeft();
- scans right to next occurrence of SearchChar.
-
- Parameters
- ----------
- int CurPos Current position within String.
- char far *String String to scan.
- char SearchChar Quit scan at this character.
-
- Return
- ------
- int CurPos Pointer to character following SearchChar.
- *************************************************************************/
-
- int pascal WordRight( int, char far *, char ); /* INUTIL.C */
-
- /*************************************************************************
- WriteMany -- Write character and attribute Num times at current
- cursor position; the cursor is not moved.
-
- Parameters
- ----------
- BYTE Chr Character to write.
- int Attr Video attribute.
- int Num Number of times to write Chr.
-
- Return
- ------
- None
- *************************************************************************/
-
- void pascal WriteMany( BYTE, int, int ); /* INUTIL.C */
-
- /**** EOF: INDECL.H ****/